// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the GNU Affero General Public License v3.0.
// See the LICENCE file in the repository root for full licence text.

.forum-topic-nav {
  @_top: forum-topic-nav;

  @_content-height: 30px;
  @_seek-bar-height: 10px;
  @_seek-bar-height-desktop: 5px;
  @_seek-bar-height-desktop-hover: 15px;
  @_seek-tooltip-arrow-height: 10px;
  width: 100%;
  background-color: @osu-colour-d4;
  position: relative;

  height: var(--main-height);

  --main-height: 40px;
  @media @desktop {
    --main-height: 50px;
  }

  &__content {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: var(--main-height);
    position: absolute;
    bottom: 0;
    left: 0;
    padding: 0 2px;

    @media @desktop {
      padding: 0 5px;
    }
  }

  &__counter {
    // enough for 5 digits
    width: 40px;
    @media @desktop {
      width: 50px;
    }

    &--input {
      .reset-input();
      color: #fff;
      display: none;

      border: 0;
    }

    &--left {
      text-align: right;
    }

    &--middle {
      width: auto;
      text-align: center;
      margin: 0 10px;
    }
  }

  &__counter-cover {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    cursor: pointer;
  }

  &__counter-container {
    .reset-input();
    .center-content();
    color: @osu-colour-c1;
    border: 2px solid transparent;
    border-radius: 10000px;
    position: relative;
    background-color: #111;
    color: @osu-colour-c1;
    text-decoration: none;

    font-size: 12px;
    margin: 0 auto;

    @media @desktop {
      font-size: 16px;
      margin: 0 @forum-topic-nav-item--gutter-desktop;
    }

    &.js-forum-topic-post-jump--container-focus {
      border-color: @yellow-darker;
    }
  }

  &__group {
    display: flex;
    flex: 1;

    &--desktop {
      display: none;

      @media @desktop {
        display: flex;
      }
    }

    &--main {
      @media @desktop {
        flex: none;
      }
    }

    &--mobile {
      flex: none;

      @media @desktop {
        display: none;
      }
    }

    &--right {
      justify-content: flex-end;
    }
  }

  &__lock-or-reply {
    &--lock {
      [data-topic-lock="0"] & {
        display: none;
      }
    }

    &--reply {
      [data-topic-lock="1"] & {
        display: none;
      }
    }
  }

  &__mobile-float {
    position: absolute;
    bottom: 100%;
    margin-bottom: 15px;

    @media @desktop {
      display: none;
    }

    &--right {
      right: @forum-topic-nav-item--gutter;
    }
  }

  &__seek-bar {
    position: absolute;
    left: 0;
    bottom: 100%;
    transition:
      width 500ms ease-out,
      height 120ms ease-out;
    cursor: pointer;
    backface-visibility: hidden;

    height: @_seek-bar-height;
    background-color: var(--forum-bg);

    @media @desktop {
      height: @_seek-bar-height-desktop;
    }

    // easier targeting
    &::after {
      content: "";
      position: absolute;
      left: 0;
      bottom: 100%;
      height: 10px;
      width: 100%;
      background-color: transparent;
    }

    .@{_top}:hover & {
      @media @desktop {
        height: @_seek-bar-height-desktop-hover;
      }
    }

    &--all {
      width: 100%;
      opacity: 0.5;

      @media @desktop {
        opacity: 0.01;
      }

      &::before {
        @media @desktop {
          display: none;
        }
      }

      .@{_top}:hover & {
        opacity: 0.5;
      }
    }
  }

  &__seek-bar-container {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: var(--main-height);
  }

  &__seek-tooltip {
    position: absolute;
    bottom: calc(
      var(--main-height) + @_seek-bar-height-desktop-hover +
        @_seek-tooltip-arrow-height
    );

    display: flex;
    width: 0;
    justify-content: center;
    will-change: opacity, transform;
  }

  &__seek-tooltip-number {
    .default-border-radius();
    background-color: @gray-dark;
    padding: 5px 20px;
    color: #fff;
    flex: none;

    &::before {
      content: "";
      position: absolute;
      top: 100%;
      left: 50%;
      margin-left: -8px;

      border-width: @_seek-tooltip-arrow-height 8px 0 8px;
      border-style: solid;
      border-color: transparent;
      border-top-color: @gray-dark;
    }
  }
}
